package com.ruoyi.estate.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.estate.mapper.OwnerInfoMapper;
import com.ruoyi.estate.domain.OwnerInfo;
import com.ruoyi.estate.service.IOwnerInfoService;

/**
 * 业主Service业务层处理
 * 
 * @author 博雅
 * @date 2023-12-12
 */
@Service
public class OwnerInfoServiceImpl implements IOwnerInfoService 
{
    @Autowired
    private OwnerInfoMapper ownerInfoMapper;

    /**
     * 查询业主
     * 
     * @param ownerId 业主主键
     * @return 业主
     */
    @Override
    public OwnerInfo selectOwnerInfoByOwnerId(Long ownerId)
    {
        return ownerInfoMapper.selectOwnerInfoByOwnerId(ownerId);
    }

    /**
     * 查询业主列表
     * 
     * @param ownerInfo 业主
     * @return 业主
     */
    @Override
    public List<OwnerInfo> selectOwnerInfoList(OwnerInfo ownerInfo)
    {
        return ownerInfoMapper.selectOwnerInfoList(ownerInfo);
    }

    /**
     * 新增业主
     * 
     * @param ownerInfo 业主
     * @return 结果
     */
    @Override
    public int insertOwnerInfo(OwnerInfo ownerInfo)
    {
        ownerInfo.setCreateTime(DateUtils.getNowDate());
        return ownerInfoMapper.insertOwnerInfo(ownerInfo);
    }

    /**
     * 修改业主
     * 
     * @param ownerInfo 业主
     * @return 结果
     */
    @Override
    public int updateOwnerInfo(OwnerInfo ownerInfo)
    {
        ownerInfo.setUpdateTime(DateUtils.getNowDate());
        return ownerInfoMapper.updateOwnerInfo(ownerInfo);
    }

    /**
     * 批量删除业主
     * 
     * @param ownerIds 需要删除的业主主键
     * @return 结果
     */
    @Override
    public int deleteOwnerInfoByOwnerIds(Long[] ownerIds)
    {
        return ownerInfoMapper.deleteOwnerInfoByOwnerIds(ownerIds);
    }

    /**
     * 删除业主信息
     * 
     * @param ownerId 业主主键
     * @return 结果
     */
    @Override
    public int deleteOwnerInfoByOwnerId(Long ownerId)
    {
        return ownerInfoMapper.deleteOwnerInfoByOwnerId(ownerId);
    }
}
